import store from '@/store'
import axios from 'axios'
import React, { Fragment, useEffect, useState } from 'react'
import { Helmet } from 'react-helmet'
import { setContent } from './store/demoReducer'

function Demo() {
  // const [contentm, setContent] = useState('')

  useEffect(() => {
    axios
      .post('/api/getDemoData', {
        content: '这是一个Demo请求页面1111',
      })
      .then((res) => {
        console.log('----store-----', store.dispatch(setContent('hello')))
        // setContent(res.data?.data?.content)
        setTimeout(() => {
          console.log('---- state -----', store.getState())
        }, 5000)
      })
    console.log('demo')
  }, [])

  return (
    <Fragment>
      <Helmet>
        <title>DemoPage</title>
        <meta name="description" content="Home page" />
      </Helmet>
      <div>
        <h1>demo demo</h1>
      </div>
    </Fragment>
  )
}

export default Demo
